home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 287_01 / gradegs.gcm < prev    next >
Text File  |  1989-05-23  |  4KB  |  87 lines

  1. font1=LoadFont("amr14.fon");    /* the font will be used later */
  2. env1=EnvSave(0);                /* save the initial environment setting */
  3. HorzLine(0,0,100,1);    /* solid horizontal line */
  4. VertLine(200,0,50,1);   /* solid vertical line */
  5. SetStyle(0x3333);       /* then different style of horizontal and  */
  6. HorzLine(0,10,100,1);   /* vertical lines                          */
  7. VertLine(210,0,50,1);
  8. SetStyle(0);
  9. HorzLine(0,20,100,1);
  10. VertLine(220,0,50,1);
  11. SetStyle(0x11ff);
  12. HorzLine(0,30,100,1);
  13. VertLine(230,0,50,1);
  14. WriteStr(0,0,0,50,"HorzLine",0,0);      /* label the horizontal lines */
  15. WriteStr(3,2,240,0,"VertLine",0,0);     /* label the vertical lines   */
  16. RelOrg(0,60);                           /* move down the origin       */
  17. SetStyle(0x3333);
  18. Circle(50,50,50);       /* Circle is not affected by style */
  19. WriteStr(0,0,23,55,"Circle",0,0);
  20. Arc1(200,50,52,0xff);   /* but Arc1 does */
  21. WriteStr(0,0,182,55,"Arc1",0,0);
  22. FillEllipse(400,50,80,30);      /* completely filled ellipse */
  23. temp2=PlotType(1);         /* change plot type and save old type in temp2 */
  24. WriteStr(0,0,353,55,"FillEllipse",0,0);
  25. PlotType(temp2);
  26. SetStyle(0xffff);
  27. Earc2(570,50,60,50,100,270);    /* Draws a arc with length 270 degrees */
  28. ArcPoint(&x1,&y1,&x2,&y2);      /* draws two lines and become a sector */
  29. Line(x1,y1,570,50);
  30. Line(570,50,x2,y2);
  31. env2=EnvSave(0);              /* <-+ save current environemnt */
  32. SetWin(570,50,570,50);        /*   | define a one-point window */
  33. Earc2(570,50,60,50,100,135);  /*   | so the arc is not drawn */
  34. ArcPoint(&x1,&y1,&x2,&y2);    /*   | but the starting and ending point  */
  35.                               /*   | coordinates are stilled calculated */
  36. EnvRsto(env2,0);              /* <-+ restore the original window setting */
  37. Line(x2,y2,570,50);           /* only draw a line for one end point */
  38. Earc2(578,45,60,50,10,90);    /* draw another arc with different center */
  39. ArcPoint(&x1,&y1,&x2,&y2);    /* complete the sector */
  40. Line(x1,y1,578,45);
  41. Line(578,45,x2,y2);
  42. PatternFill(560,40,pattern2,0); /* fill the three different region with */
  43. PatternFill(570,60,pattern3,0); /* different pattern                    */
  44. PatternFill(590,30,pattern1,0);
  45. SetOrg(0,195);
  46. font2=SelectFont(font1);
  47. WriteStr(0,0,100,0,"Examples",0,0);     /* an example on text display */
  48. NextXY(&x1,&y1);
  49. Line(100,0,x1,y1);
  50. PrintPage();
  51. EnvRsto(env1,0);        /* restore environment on start time */
  52.                 /* an example on Draw */
  53. Draw("NW DN12 RT16 AS0xc0 EL16,12 UP12 WR RT600",0,0);
  54. Draw("NW     DN12 AS0x03 EL16,12 RT16 WR DN160",0,0);
  55. Draw("NW     LF16 AS0x0c EL16,12 DN12 WR LF600",0,0);
  56. Draw("NW     UP12 AS0x30 EL16,12 LF16 WR UP160",0,0);
  57. SetOrg(99,19);
  58. HorzLine(8,6,204,104);  /* draw a rectangular plane */
  59. PlotType(1);
  60. HorzLine(0,0,205,105);  /* clear most part of it */
  61. PlotType(0);
  62. Rectangle(0,0,203,103); /* draw a outline */
  63. RelOrg(1,1);
  64. SetWin(0,0,200,100);    /* create window 1 */
  65. temp1=EnvSave(0);       /* save window 1 environment */
  66.  
  67. SetOrg(400,20);         /* create window 2 environment */
  68. SetWin(0,0,100,100);
  69. HorzLine(0,0,1000,1000);
  70. PlotType(1);
  71. temp2=EnvSave(0);       /* save the environment */
  72.  
  73. Circle(50,50,55);
  74. Line(0,0,200,200);
  75. Line(100,0,0,100);
  76.  
  77. EnvRsto(temp1,0x8000);  /* restore window 1 environment and keep the slot */
  78. WriteStr(0,0,0,10,
  79.       "This window is not affected",0,0);
  80. WriteStr(0,0,0,20,
  81.       "By the other window.",0,0);
  82.  
  83. EnvRsto(temp2,0x8000);  /* restore window 2 environment and keep the slot */
  84. Box(5,5,90,90,2,2);
  85. SolidFill(40,50);
  86. PrintPage();
  87.